package com.teziyou.commodity.util;

import java.util.Map;

/**
 * threadlocal工具类
 * @author kangrui
 *
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public class ThreadLocalUtil {
	
	private static ThreadLocal<Map> tl = new ThreadLocal<Map>() {
		@Override
		protected Map initialValue() {
			return Maps.newHashMap();
		}
	};
	
	public static Map<String, Object> put(Object key, Object value) {
		Map map = tl.get();
		map.put(key, value);
		return map;
	}
	
	public static Object get(Object key) {
		return tl.get().get(key);
	}
	
	public static void remove() {
		tl.remove();
	}
	
}
